package in.muton.panels.paginator.badgehelpers.course;

import in.muton.edushare.EduShareSession;
import in.muton.panels.paginator.helpers.BadgeInterface;

import org.apache.wicket.model.IModel;

import com.edushare.common.dao.GroupsDAO;
import com.edushare.common.vo.Groups;
import com.edushare.common.vo.Users;

public class GroupBadgeInterface implements BadgeInterface {
	private static final long serialVersionUID = 6551995898722573413L;

	public GroupBadgeInterface() {
	}

	public String removeGroup(IModel<Groups> group) {
		String s = "Group "+ group.getObject().getGroupName()+" has been deleted.";
		new GroupsDAO(EduShareSession.get().getSessionORMInterface())
				.deleteGroup(group.getObject());
		return s;
	}

	public boolean isAdmin(Groups g) {
		Users user = EduShareSession.get().getLoggedInUser();
		return user.isGroupAdmin(g);
	}
}
